package com.msh.frame.client.model;

import com.msh.frame.client.common.ITreeConstructor;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@Schema(title = "项目信息Vo")
@NoArgsConstructor
public class TreeVo implements ITreeConstructor<TreeVo>, Serializable {
    private Object key;
    private Object parentKey;
    private int layer;
    private List<TreeVo> children;

    private String title;

    @Override
    public Object key() {
        return key;
    }

    @Override
    public Object parentKey() {
        return parentKey;
    }

    @Override
    public boolean layerOne() {
        return layer == 1;
    }

    @Override
    public List<TreeVo> getChildren() {
        return children;
    }

    @Override
    public TreeVo setChildren(List<TreeVo> list) {
        this.children = list;
        return this;
    }

    public TreeVo(Object key, Object parentKey, int layer, String title) {
        this.key = key;
        this.parentKey = parentKey;
        this.layer = layer;
        this.title = title;
    }
}
